package com.wn.generator;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.config.rules.DateType;

import java.util.Collections;

/**
 * @author yellow Docter
 * @date 2023 -07-20
 * @desc  生成还款计划
 *        进行还款
 */
public class AppPay {

    public static void main(String[] args) {

        String path = "C:\\蜗牛\\深圳15期\\四阶段\\code-demo04\\sddfp\\sddfp-service\\sddfp-pay-back-service\\src\\main\\";
        FastAutoGenerator.create(
                        "jdbc:mysql://localhost:3306/sddfp_pay_back", "root", "root")
                .globalConfig(builder -> {
                    builder.author("yellow docker") // 设置作者
                            .enableSwagger() // 开启 swagger 模式
                            .dateType(DateType.ONLY_DATE)
                            .disableOpenDir()
                            .outputDir( path + "/java"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.wn.pay") // 设置父包名
                            .moduleName(null) // 设置父包模块名
                            .pathInfo(Collections.singletonMap(
                                    OutputFile.xml, path + "/resources/mapper")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> {
                    builder.entityBuilder().enableLombok();
                    builder.controllerBuilder().enableHyphenStyle().enableRestStyle();
                    builder.addInclude(
                            "agency_receive_item",
                            "agency_receive_plan",
                            "borrower_pay_item",
                            "borrower_pay_plan"
                    );// 设置需要生成的表名
                })
                .execute();
    }

}
